package com.itheima.proxy.cglib;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @program: design
 * @description:
 * @author: zhanghz001
 * @create: 2020-11-26 17:30
 **/
public class SFangProxy implements MethodInterceptor {
    private final LandlordService landlordService;

    public SFangProxy(LandlordService landlordService) {
        this.landlordService = landlordService;
    }

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        objects[0] = "搜房网的带客户  " + objects[0];
        return method.invoke(landlordService, objects);
    }
}
